package com.xoa.service.party;

import com.xoa.dao.common.SysCodeMapper;
import com.xoa.dao.party.*;
import com.xoa.model.common.SysCode;
import com.xoa.model.party.*;
import com.xoa.model.users.Users;
import com.xoa.util.ToJson;
import com.xoa.util.common.L;
import com.xoa.util.common.StringUtils;
import com.xoa.util.common.session.SessionUtils;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.CellType;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.File;
import java.io.InputStream;
import java.text.SimpleDateFormat;
import java.util.*;

/**
 * Created by 程叶同 on 2017-12-11.
 */
@Service
public class FormUpLoadService {

    @Autowired
    private SmallScaleSecurityUnitMapper smallScaleSecurityUnitMapper;

    @Autowired
    private GeneralSafetyUnitMapper generalSafetyUnitMapper;

    @Autowired
    private FixFormMapper fixFormMapper;

    @Autowired
    private ThreeFormMapper threeFormMapper;

    @Autowired
    private FourFormMapper fourFormMapper;
    @Autowired
    private GridInfoMapper gridInfoMapper;
    @Autowired
    private SysCodeMapper sysCodeMapper;
    @Autowired
    MapOwnerinfoMapper mapOwnerinfoMapper;

    @Transactional
    public ToJson<Object> inputFile(HttpServletRequest request, HttpServletResponse response, MultipartFile file, HttpSession session) {
        ToJson<Object> json = new ToJson<Object>(1, "error");
        Users users= SessionUtils.getSessionInfo(request.getSession(), Users.class,new Users());
        try {
            //读取配置文件
            //判读当前系统
            ResourceBundle rb = ResourceBundle.getBundle("upload");
            //String name = rb.getString("mysql.driverClassName");
            String osName = System.getProperty("os.name");
            StringBuffer path = new StringBuffer();
            if (osName.toLowerCase().startsWith("win")) {
                path = path.append(rb.getString("upload.win"));
            } else {
                path = path.append(rb.getString("upload.linux")).append("/");
            }
            if (file.isEmpty()) {
                json.setMsg("请上传文件！");
                return json;
            } else {
                String fileName = file.getOriginalFilename();
                if (fileName.endsWith(".xls") || fileName.endsWith(".xlsx")) {
                    String uuid = UUID.randomUUID().toString().replaceAll("-", "");
                    int pos = fileName.indexOf(".");
                    String extName = fileName.substring(pos);
                    String newFileName = uuid + extName;

                    File dest = new File(path.toString(),newFileName);
//                    dest.createNewFile();
//                    file.transferTo(dest);
                    // 将文件上传成功后进行读取文件
                    // 进行读取的路径
                    String readPath = path.append(newFileName).toString();
//                    InputStream in = new FileInputStream(readPath);
                    InputStream in =  file.getInputStream();
                    HSSFWorkbook excelObj = new HSSFWorkbook(in);
                    HSSFSheet sheetObj = excelObj.getSheetAt(0);
                    Row row = sheetObj.getRow(0);
                    int colNum = row.getPhysicalNumberOfCells();
                    int lastRowNum = sheetObj.getLastRowNum();
                    int insertConut=0;
                    int updateConut=0;
                    Integer counsum[] =new Integer[2];
                    Map map=new HashMap<String,Object>();
                    for(int i=1;i<=lastRowNum;i++){
                        SmallScaleSecurityUnitWithBLOBs smallScaleSecurityUnit=new SmallScaleSecurityUnitWithBLOBs();
                        GeneralSafetyUnitWithBLOBs generalSafetyUnit=new GeneralSafetyUnitWithBLOBs();
                        ThreeForm threeForm=new ThreeForm();
                        FourFormWithBLOBs fourForm=new FourFormWithBLOBs();
                        FixFormWithBLOBs fixForm=new FixFormWithBLOBs();
                        row=sheetObj.getRow(i);
                        String value="";
                        if(row!=null){
                            Cell c0 = row.getCell(0); //序号
                            Cell c1 = row.getCell(1); //企业类型
                            Cell c2 = row.getCell(2); //生产经营单位名称
                            Cell c3 = row.getCell(3); //生产经营单位地址
                            Cell c4 = row.getCell(4); //企业负责人
                            Cell c5 = row.getCell(5); //企业负责人手机
                            Cell c6 = row.getCell(6); //注册地址
                            Cell c7 = row.getCell(7); //法人名称
                            Cell c8 = row.getCell(8); //法人电话
                            Cell c9 = row.getCell(9); //社会统一信用代码
                            Cell c10 = row.getCell(10); //企业工商注册号
                            Cell c11 = row.getCell(11); //组织机构代码
                            Cell c12 = row.getCell(12);  //国民经济类型
                            Cell c13 = row.getCell(13);  //监管行业分类
                            Cell c14 = row.getCell(14);  //是否涉及危险化学品
                            Cell c15 = row.getCell(15);  //职业危害因素
                            Cell c16 = row.getCell(16);  //是否涉及有限空间作业
                            Cell c17 = row.getCell(17);  //有无燃气或液化石油气场所
                            Cell c18 = row.getCell(18);  //安全生产标准化评审等级
                            Cell c19 = row.getCell(19);  //所属社区
                            Cell c20=row.getCell(20);//位置
                            String gridId = null;
                             if(c19!=null){
                                 SysCode sysCode=new SysCode();
                                 sysCode.setCodeName(c19.getStringCellValue());
                                 sysCode.setParentNo("TYPE_OF_ACCOUNT");
                                 if(sysCodeMapper.getCodeNoByNameAndParentNo(sysCode)!=null){
                                     gridId=sysCodeMapper.getCodeNoByNameAndParentNo(sysCode).getCodeNo();

                          }
                             }

                            if(c1!=null){
                                if("小规模法人单位".equals(c1.getStringCellValue().trim())){

                                    if(c11!=null){
                                        c11.setCellType(CellType.STRING);
                                        smallScaleSecurityUnit.setOrganizationCode(c11.getStringCellValue());
                                    }
                                    if(c2!=null){
                                        smallScaleSecurityUnit.setUnitName(c2.getStringCellValue());
                                    }
                                    if(c3!=null){
                                        smallScaleSecurityUnit.setUnitLocationArea(c3.getStringCellValue());

                                    }
                                    if(c7!=null){
                                        smallScaleSecurityUnit.setLegalRepresentative(c7.getStringCellValue());

                                    }
                                    if(c8!=null){
                                        c8.setCellType(CellType.STRING);
                                        smallScaleSecurityUnit.setMobilePhone(c8.getStringCellValue());

                                    }
                                    if(c6!=null){
                                        smallScaleSecurityUnit.setUnitRegistrationPlaceProvince(c6.getStringCellValue());

                                    }
                                    if(c10!=null){
                                        smallScaleSecurityUnit.setBusinessRegistrationNo(c10.getStringCellValue());

                                    }
                                    if(c12!=null){


                                    }


                                if(c20!=null){
                                    smallScaleSecurityUnit.setEnterpriseCoordinate(mapOwnerinfoMapper.selectCoordingbyName(c20.getStringCellValue()));
                                }



                                    if(c14!=null){



                                        if(c14.getStringCellValue().equals("是")){

                                            smallScaleSecurityUnit.setHazardousChemicalsInvolved(0);

                                        }else if (c14.getStringCellValue().equals("否")){

                                            smallScaleSecurityUnit.setHazardousChemicalsInvolved(1);
                                        }



                                    }
                                    if(c16!=null){
                                        if(c16.getStringCellValue().equals("是")){

                                            smallScaleSecurityUnit.setOperationsInvolvingFiniteSpaces(0);

                                        }else if (c16.getStringCellValue().equals("否")){

                                            smallScaleSecurityUnit.setOperationsInvolvingFiniteSpaces(1);
                                        }

                                    }

                                    smallScaleSecurityUnit.setEnterpriseCharacteristics("1");
                                    smallScaleSecurityUnit.setEnterpriseState("02");
                                    if(gridId!=null){
                                        smallScaleSecurityUnit.setGridCode(gridId);
                                    }

                                    if(smallScaleSecurityUnit.getOrganizationCode()!=null || smallScaleSecurityUnit.getBusinessRegistrationNo()!=null){
                                        map.put("organizationCode",smallScaleSecurityUnit.getOrganizationCode());
                                        map.put("businessRegistrationNo",smallScaleSecurityUnit.getBusinessRegistrationNo());
                                        map.put("unitName",c2.getStringCellValue());
                                        //查询该条记录是否存在
                                        List<SmallScaleSecurityUnitWithBLOBs> smallScaleSecurityUnit1=smallScaleSecurityUnitMapper.selectOnekey(map);
                                        //查询判断导入修改还是导入
                                        if(smallScaleSecurityUnit1.size()>0&&smallScaleSecurityUnit1.size()==1){
                                            int count=smallScaleSecurityUnitMapper.updateByPrimaryKeySelective(smallScaleSecurityUnit1.get(0));
                                            if(count>0){
                                                updateConut++;
                                            }
                                        }else {
                                            smallScaleSecurityUnit.setFormHolder(users.getUserName());
                                            smallScaleSecurityUnit.setDateOfPublication(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                                            int count=smallScaleSecurityUnitMapper.insertSelective(smallScaleSecurityUnit);
                                            if(count>0){
                                                insertConut++;
                                            }
                                        }
                                    }
                                }

                                if("一般法人单位".equals(c1.getStringCellValue().trim())){
                                    if(c11!=null){
                                        c11.setCellType(CellType.STRING);
                                        generalSafetyUnit.setOrganizationCode(c11.getStringCellValue());
                                    }
                                    if(c2!=null){
                                        generalSafetyUnit.setUnitName(c2.getStringCellValue());
                                    }
                                    if(c3!=null){
                                        generalSafetyUnit.setUnitLocationArea(c3.getStringCellValue());

                                    }
                                    if(c7!=null){
                                        generalSafetyUnit.setLegalRepresentative(c7.getStringCellValue());

                                    }
                                    if(c8!=null){
                                        c8.setCellType(CellType.STRING);
                                        generalSafetyUnit.setMobilePhone(c8.getStringCellValue());

                                    }
                                    if(c6!=null){
                                        generalSafetyUnit.setUnitRegistrationPlaceProvince(c6.getStringCellValue());

                                    }
                                    if(c10!=null){
                                        generalSafetyUnit.setBusinessRegistrationNo(c10.getStringCellValue());

                                    }
                                    if(gridId!=null&&"".equals(gridId)){
                                        generalSafetyUnit.setGridCode(gridId);
                                    }
                                    if(c20!=null){
                                        smallScaleSecurityUnit.setEnterpriseCoordinate(mapOwnerinfoMapper.selectCoordingbyName(c20.getStringCellValue()));
                                    }

                                    generalSafetyUnit.setEnterpriseState("02");
                                    if(generalSafetyUnit.getOrganizationCode()!=null || generalSafetyUnit.getBusinessRegistrationNo()!=null){
                                        //查询该条记录是否存在
                                        map.put("organizationCode",generalSafetyUnit.getOrganizationCode());
                                        map.put("businessRegistrationNo",generalSafetyUnit.getBusinessRegistrationNo());
                                        map.put("unitName",c2.getStringCellValue());
                                        //查询该条记录是否存在
                                        List<GeneralSafetyUnitWithBLOBs> generalSafetyUnit1=generalSafetyUnitMapper.selectOnekey(map);
                                        //查询判断导入修改还是导入
                                        if(generalSafetyUnit1.size()>0&&generalSafetyUnit1.size()==1){
                                            int count=generalSafetyUnitMapper.updateByPrimaryKeySelective(generalSafetyUnit1.get(0));
                                            if(count>0){
                                                updateConut++;
                                            }
                                        }else {
                                            generalSafetyUnit.setFormHolder(users.getUserName());
                                            generalSafetyUnit.setContactNumber(users.getMobilNo());
                                            generalSafetyUnit.setDateOfPublication(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                                            int count=generalSafetyUnitMapper.insertSelective(generalSafetyUnit);
                                            if(count>0){
                                                insertConut++;
                                            }
                                        }
                                    }
                                }
                                if("小型个体工商户".equals(c1.getStringCellValue().trim())){

                                    if(c2!=null){
                                        fourForm.setEnBusinessName(c2.getStringCellValue());
                                    }
                                    if(c3!=null){
                                        fourForm.setPrAddress(c3.getStringCellValue());

                                    }
                                    if(c7!=null){
                                        fourForm.setOpName(c2.getStringCellValue());

                                    }
                                    if(c20!=null){
                                        smallScaleSecurityUnit.setEnterpriseCoordinate(mapOwnerinfoMapper.selectCoordingbyName(c20.getStringCellValue()));
                                    }
                                    if(c4!=null){
                                        fourForm.setLightnDetect(c4.getStringCellValue());

                                    }else{
                                        fourForm.setLightnDetect("");
                                    }
                                    if(c5!=null){
                                        fourForm.setMobPh(c5.getStringCellValue());

                                    }else{
                                        fourForm.setLightnDetect("");
                                    }
                                    if(c10!=null){
                                        fourForm.setBsLicenseRegist(c10.getStringCellValue());

                                    }
                                    if(gridId!=null&&"".equals(gridId)){
                                        fourForm.setGridCode(gridId);
                                    }
                                    fourForm.setEnState("02");
                                    //查询该条记录是否存在
                                   String  bsLicenseRegist=c2.getStringCellValue();
                                   if(!StringUtils.checkNull(bsLicenseRegist)){
                                       //查询该条记录是否存在
                                       List<FourFormWithBLOBs> fourFormWithBLOBs=fourFormMapper.selectOnekeyOther(bsLicenseRegist);
                                       //查询判断导入修改还是导入
                                       if(fourFormWithBLOBs.size()>0&&fourFormWithBLOBs.size()==1){
                                           int count=fourFormMapper.updateByPrimaryKeySelective(fourFormWithBLOBs.get(0));
                                           if(count>0){
                                               updateConut++;
                                           }
                                       }else {
                                           fourForm.setFillingMan(users.getUserName());
                                           fourForm.setContactNumber(users.getMobilNo());
                                           fourForm.setReportDate(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                                           int count=fourFormMapper.insertSelective(fourForm);
                                           if(count>0){
                                               insertConut++;
                                           }
                                       }
                                   }
                                }
                                if("大型个体工商户".equals(c1.getStringCellValue().trim())){

                                    if(c2!=null){
                                        threeForm.setEnBusinessName(c2.getStringCellValue());
                                    }
                                    if(c3!=null){
                                        threeForm.setPrAddress(c3.getStringCellValue());

                                    }
                                    if(c7!=null){
                                        threeForm.setOpName(c2.getStringCellValue());

                                    }
                                    if(c20!=null){
                                        smallScaleSecurityUnit.setEnterpriseCoordinate(mapOwnerinfoMapper.selectCoordingbyName(c20.getStringCellValue()));
                                    }
                                    if(c4!=null){
                                        threeForm.setLightnDetect(c4.getStringCellValue());

                                    }else{
                                        threeForm.setLightnDetect("");
                                    }
                                    if(c5!=null){
                                        threeForm.setMobPh(c5.getStringCellValue());

                                    }else{
                                        threeForm.setLightnDetect("");
                                    }
                                    if(c8!=null){
                                        threeForm.setMobPh(c8.getStringCellValue());

                                    }

                                    if(c10!=null){
                                        threeForm.setBsLicenseRegist(c10.getStringCellValue());

                                    }
                                    if(gridId!=null&&"".equals(gridId)){
                                        threeForm.setGridCode(gridId);
                                    }

                                    threeForm.setMajorActivities("03");
                                    threeForm.setEnState("02");



                                    //查询该条记录是否存在
                                    String  bsLicenseRegist=c2.getStringCellValue();
                                    if(!StringUtils.checkNull(bsLicenseRegist)){
                                        //查询该条记录是否存在
                                        List<ThreeForm> threeForm1=threeFormMapper.selectOnekeyOther(bsLicenseRegist);
                                        //查询判断导入修改还是导入
                                        if(threeForm1.size()>0&&threeForm1.size()==1){
                                            int count=threeFormMapper.update(threeForm1.get(0));
                                            if(count>0){
                                                updateConut++;
                                            }
                                        }else {
                                            threeForm.setFillingMan(users.getUserName());
                                            threeForm.setContactNumber(users.getMobilNo());
                                            threeForm.setReportTime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                                            int count=threeFormMapper.insert(threeForm);
                                            if(count>0){
                                                insertConut++;
                                            }
                                        }
                                    }
                                }
                                if("在建工程".equals(c1.getStringCellValue().trim())){
                                    if(c11!=null){
                                        fixForm.setItemCodeno4(c1.getStringCellValue());

                                    }
                                    if(c20!=null){
                                        smallScaleSecurityUnit.setEnterpriseCoordinate(mapOwnerinfoMapper.selectCoordingbyName(c20.getStringCellValue()));
                                    }
                                    if(c2!=null){
                                        fixForm.setItemName(c2.getStringCellValue());
                                    }
                                    if(c3!=null){
                                        smallScaleSecurityUnit.setUnitLocationArea(c3.getStringCellValue());

                                    }
                                    if(c4!=null){
                                        fixForm.setItemManager(c4.getStringCellValue());

                                    }
                                    if(c5!=null){
                                        fixForm.setItemManagerno(c5.getStringCellValue());

                                    }else{
                                        fixForm.setItemManagerno("");
                                    }
                                    if(gridId!=null&&"".equals(gridId)){
                                        fixForm.setGridCode(gridId);
                                    }
                                    fixForm.setItemJob("自保");
                                    fixForm.setItemType("02");
                                    //查询判断导入修改还是导入
                                     String  itemCodeno=c2.getStringCellValue();
                                     if(!StringUtils.checkNull(itemCodeno)){
                                         List<FixFormWithBLOBs> fixForm1=fixFormMapper.selectOnekeyOther(itemCodeno);
                                         if(fixForm1.size()>0&&fixForm1.size()==1){
                                             int count=fixFormMapper.updateByExampleSelective(fixForm1.get(0));
                                             if(count>0){
                                                 updateConut++;
                                             }
                                         }else{
                                             //如果没值就插入
                                             fixForm.setItemUseid(users.getUserName());
                                             fixForm.setItemUseidtel(users.getMobilNo());
                                             fixForm.setItemUseiddatetime(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
                                             int count=fixFormMapper.insertSelective(fixForm);
                                             if(count>0){
                                                 insertConut++;
                                             }
                                         }
                                     }
                                }
                            }







                            /*for(int j=0;j<colNum;j++){



                                Cell cell=row.getCell(j);
                                if(cell!=null){

                                   if(j==1){
                                       String text=cell.getStringCellValue();
                                       value = text.toString();
                                       if(null!=value&&!"".equals(value.trim())){
                                           String[] item = value.split("[.]");
                                           if(1<item.length&&"0".equals(item[1])){
                                               value=item[0];
                                           }
                                       }
                                   }
                                }
                            }*/
                        }


                    }
                    /*String uuid = UUID.randomUUID().toString();
                    uuid = uuid.replaceAll("-", "");
                    int pos = fileName.indexOf(".");
                    String extName = fileName.substring(pos);
                    String newFileName = uuid + extName;
                    File dest = new File(path.toString(), newFileName);
                    *//*file.transferTo(dest);*//*
                    //将文件上传成功后进行读取文件
                    //进行读取的路径
                    String readPath = path.append(newFileName).toString();
                    InputStream in = new FileInputStream(readPath);
                    HSSFWorkbook excelObj = new HSSFWorkbook(in);
                    HSSFSheet sheetObj = excelObj.getSheetAt(0);
                    Row rowObj = null;
                    int lastRowNum = sheetObj.getLastRowNum();
                    int inputFail=0;
                    int inputSuccess=0;
                    String faillReason="";*/
                    /*for (int i = 2; i <= lastRowNum; i++) {
                        rowObj = sheetObj.getRow(i);
                        if (rowObj != null) {
                            Cell c0 = rowObj.getCell(0);
                            Cell c1 = rowObj.getCell(1);
                            Cell c2 = rowObj.getCell(2);
                            Cell c3 = rowObj.getCell(3);
                            Cell c4 = rowObj.getCell(4);
                            Cell c5 = rowObj.getCell(5);
                            Cell c6 = rowObj.getCell(6);
                            Cell c7 = rowObj.getCell(7);
                            Cell c8 = rowObj.getCell(8);
                            Cell c9 = rowObj.getCell(9);
                            Cell c10 = rowObj.getCell(10);
                            if(c0.getStringCellValue()!=""&&c1.getStringCellValue()!=""&&c2.getStringCellValue()!=""){
                                EduFixAssets eduFixAssets = new EduFixAssets();
                                eduFixAssets.setId(c0.getStringCellValue());
                                eduFixAssets.setAssetsName(c1.getStringCellValue());
                                eduFixAssets.setBuyTime(DateFormat.DateToStr(c2.getStringCellValue()));
                                eduFixAssets.setInfo(c3.getStringCellValue());
                                if(!StringUtils.checkNull(c4.getStringCellValue())){
                                    eduFixAssets.setNumber(Integer.valueOf(c4.getStringCellValue()));
                                }
                                if(!StringUtils.checkNull(c5.getStringCellValue())){
                                    if(departmentMapper.getDeptById(Integer.parseInt(c5.getStringCellValue()))!=null){
                                        eduFixAssets.setLocationAddress(departmentMapper.getDeptById(Integer.parseInt(c5.getStringCellValue())).getDeptName());
                                    }
                                }
                                if(!StringUtils.checkNull(c6.getStringCellValue())){
                                    if(usersMapper.findUsersByuserId(c6.getStringCellValue())!=null){
                                        eduFixAssets.setCustodion(usersMapper.findUsersByuserId(c6.getStringCellValue()).getUserId());
                                    }
                                }
                                eduFixAssets.setInfo(c7.getStringCellValue());
                                eduFixAssets.setRemake(c8.getStringCellValue());
                                if(!StringUtils.checkNull(c9.getStringCellValue())){
                                    if(usersMapper.findUsersByuserId(c9.getStringCellValue())!=null){
                                        eduFixAssets.setCreater(usersMapper.findUsersByuserId(c9.getStringCellValue()).getUserId());
                                    }
                                }
                                if(!StringUtils.checkNull(c10.getStringCellValue())){
                                    eduFixAssets.setCreaterTime(DateFormat.DateToStr(c10.getStringCellValue()));
                                }
                                if(eduFixAssetsMapper.selFixAssetsById(c0.getStringCellValue())!=null){
                                    eduFixAssetsMapper.insert(eduFixAssets);
                                    inputSuccess++;
                                }else {
                                    inputFail++;
                                    faillReason+=c0.getStringCellValue()+",";
                                    continue;
                                }
                            }
                        }
                    }
                    EduFixAssets temp=new EduFixAssets();
                    temp.setInputFail(inputFail);
                    temp.setInputSuccess(inputSuccess);
                    temp.setInputFailReason(faillReason);*/
                    counsum[0]=insertConut;
                    counsum[1]=updateConut;
                    json.setFlag(0);
                    json.setMsg("ok");
                    json.setObject(counsum);
                    dest.delete();
                } else {
                    json.setMsg("0");//文件类型不正确
                    return json;
                }
            }
        } catch (Exception e) {
            json.setMsg(e.getMessage());
            L.e("error:"+e);
            e.printStackTrace();
        }

        return json;
    }

    /*public BaseWrapper getFileModel(HttpServletResponse response, HttpServletRequest request){
            BaseWrapper baseWrapper=new BaseWrapper();

            try {
                *//*HSSFWorkbook workbook1 = ExcelUtil.makeExcelHead("企业台账信息模板", 3);*//*
                String[] secondTitles = {"序号","企业类型","生产经营单位名称","生产经营地址","企业负责人姓名","企业负责人手机","注册地址","法人名称","法人电话","社会统一信用代码","企业工商注册号","组织机构代码","国民经济类型","监管行业分类","是否涉及危险化学品","职业危害因素","是否涉及有限空间作业","有无燃气或液化石油气场所","安全生产标准化评审等级"
                };
                HSSFWorkbook workbook2 = ExcelUtil.makeSecondHead(null, secondTitles);

                // String[] beanProperty = {user.getDep().getDeptName(),"userName","userPrivName", "roleAuxiliaryName","online","sex","online","telNoDept","telNoDept","departmentPhone","email"};
                *//*String[] beanProperty = {"newsId","subject","newsDateTime", "provider"};*//*

                *//*HSSFWorkbook workbook = ExcelUtil.exportExcelData(workbook2, notifyList, beanProperty);*//*
                ServletOutputStream out = response.getOutputStream();

                String filename = "企业台账信息模板.xls";
                filename = FileUtils.encodeDownloadFilename(filename,
                        request.getHeader("user-agent"));
                response.setContentType("application/vnd.ms-excel");
                response.setHeader("content-disposition",
                        "attachment;filename=" + filename);
                *//*workbook.write(out);*//*
                out.flush();
                out.close();
            } catch (Exception e) {
                baseWrapper.setMsg(e.getMessage());
                baseWrapper.setFlag(false);
                e.printStackTrace();
            }

            baseWrapper.setFlag(true);
            baseWrapper.setMsg("ok");
            return  baseWrapper;
        }*/

}

